package demo;

public class Test {
    public static void main(String[] args) {
        //Animal animal = new Animal("柯基",5);
        //animal.eat();
        //Animal animal = new Dog("旺财",10);
        //Dog dog = (Dog)animal;
        //dog.bark();
        Dog dog  = new Dog("金毛",3);
        Animal animal = dog;   //向上转型（自动转型）
        animal.eat();
    }
}
